/**
 * Created by sun on 2016/9/18.
 */


define(function (require) {
    var app = require('/../js/app');
    require('ui-table');


    var toastr =require('toastr');
    app.useModule("ui.table");

    var datepicker = require('datepicker');
    app.controller('account_listCtrl', ['$scope','$http','$filter' ,function ($scope, $http,$filter) {
        $scope.ctrlScope=$scope;
        $scope.add={};
        $scope.select2Options = {
            minimumResultsForSearch: Infinity //不出现搜索框
        };
        $scope.orderParams = {
            url: "/admin/sysuser/getGuaranteeList",
            ajax:{type:4}

        };
        datepicker($scope);


        //搜索
        $scope.search = function() {
            $scope.ctrlScope.itemsearch.beginDate=$scope.ctrlScope.itemsearch.beginDatex;
            $scope.ctrlScope.itemsearch.endDate= $scope.ctrlScope.itemsearch.endDatex;
            $scope.ctrlScope.itemsearch.beginDate=$filter('date')($scope.ctrlScope.itemsearch.beginDate,'yyyy-MM-dd');
            $scope.ctrlScope.itemsearch.endDate=$filter('date')($scope.ctrlScope.itemsearch.endDate,'yyyy-MM-dd');
            $scope.ctrlScope.itemsearch.type=4;
            $scope.orderParams.ajaxParam=$scope.ctrlScope.itemsearch;
            $scope.orderParams.reload();
        };

        //全局查询重置
        $scope.reset=function(){
            $scope.ctrlScope.itemsearch={};
            $scope.orderParams.ajaxParam={type:'4'};
            $scope.orderParams.reload();

        };

        //跳转先锋页面
        var SERVERHOST = window.location.protocol +"//"+window.location.host;
        $scope.xfInformation = function(id) {
            window.open(SERVERHOST+'/admin/user/xfInformation?id='+id);
        };

    }]);

});